<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/common/global.jsp" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>广东石油化工学院学生信息管理系统 - 学期分数</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" type="text/css" href="${path}/static/js/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/static/css/admin.css"/>
    <link rel="shortcut icon" href="${path}/static/images/title/42496school_99040.ico" type="image/x-icon">

</head>
<body>
<div class="layui-tab page-content-wrap">
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <select class="layui-select" id="coursename" name="coursename">
                        <option value="" selected disabled style="display: none;">请选择课程类型</option>
                        <c:forEach items="${courseList}" var="course">
                            <option value="${course.coursename}">${course.coursename}</option>
                        </c:forEach>
                    </select>
                </div>
                <button class="layui-btn layui-btn-normal" onclick="findAllByCourseName()">搜索
                </button>
            </div>
            <div class="layui-form">
                <table class="layui-table" lay-skin="line">
                    <colgroup>
                        <col width="50">
                        <col class="hidden-xs" width="200">
                        <col class="hidden-xs" width="250">
                        <col class="hidden-xs" width="250">
                        <col class="hidden-xs" width="250">
                        <col class="hidden-xs" width="250">
                        <col class="hidden-xs" width="250">
                        <col class="hidden-xs" width="200">
                    </colgroup>
                    <thead>
                    <tr>
                        <th></th>
                        <th class="hidden-xs">课程名称</th>
                        <th class="hidden-xs">课程类型</th>
                        <th class="hidden-xs">任课教师</th>
                        <th class="hidden-xs">课程学分</th>
                        <th class="hidden-xs">课程平时成绩</th>
                        <th class="hidden-xs">考试成绩</th>
                        <th class="hidden-xs">总成绩</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${courseList}" var="course" varStatus="index">
                        <tr class="parent collapsed">
                            <td class="hidden-xs">${index.index + 1}</td>
                            <td class="hidden-xs">${course.coursename}</td>
                            <td>${course.coursetype}</td>
                            <td>${course.teachername}</td>
                            <td>${course.coursexf}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${course.usualgrades  == '-1.0'}">
                                        未出成绩
                                    </c:when>
                                    <c:otherwise>
                                        ${course.usualgrades}
                                    </c:otherwise>
                                </c:choose>
                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${course.examgrade  == '-1.0'}">
                                        未出成绩
                                    </c:when>
                                    <c:otherwise>
                                        ${course.examgrade}
                                    </c:otherwise>
                                </c:choose>

                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${course.totalgrade  == '-1'}">
                                        未出成绩
                                    </c:when>
                                    <c:otherwise>
                                        ${course.totalgrade}
                                    </c:otherwise>
                                </c:choose>

                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script src="${path}/static/js/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['form', 'element', 'jquery', 'layer'], function () {
        var form = layui.form,
            $ = layui.jquery,
            layer = layui.layer,
            element = layui.element;

        window.findAllByCourseName = function () {
            var coursename = $('#coursename').val();
            if(coursename === undefined){
                layer.msg('请选择课程类型', {offset: '60px', icon: 5, anim: 6, time: 3000});
                return;
            }
            window.location.href="${path}/user/getCourseForName?coursename="+ coursename;
            return false;
        }

    })
</script>

</body>
</html>